import React from "react"
import imgurl from "./../imgs/pic.jpg"

class ImgMove extends React.Component{
    state={
        x:0,
        y:0
    }
    getMove=(e)=>{
        this.setState({
            x:e.clientX,
            y:e.clientY
        })
    }
    render(){
        return <img src={imgurl} alt="" style={{
            position:"absolute",
            top:this.state.y,
            left:this.state.x
        }}></img>
    }
    componentDidMount(){
        window.addEventListener("mousemove",this.getMove)
    }
}

export default ImgMove